<template>
  <div>
    <h1>Parent组件</h1>
    <!-- 使用子组件 步骤3：调用组件 -->
    <child :inpmsg="pmsg" @sendmsg="getVal"></child>
    <div>
        接收进来的数据为：{{ incmsg }}
    </div>
  </div>
</template>

<script>
// 使用子组件 步骤1：导入child组件
import child from "./Child.vue";
export default {
  //   使用子组件 步骤2：注册子组件
  components: {
    child,
  },
  data() {
    return {
      pmsg: "父的data",
      incmsg: "",
    }
  },
  methods: {
    getVal(inmsg) {
      this.incmsg = inmsg;
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
